import { Module } from '@nestjs/common';
import { ConfigModule as Config } from '@nestjs/config';
import * as Joi from 'joi';
const envFilePath = [`.env.${process.env.NODE_ENV || 'dev'}`, '.env'];
const schema = Joi.object({
  NODE_ENV: Joi.string().valid('dev', 'prod'),
  PORT: Joi.number(),
  JWT_SECRET: Joi.string().required(),
  JWT_EXPIRES_IN: Joi.string().required(),
});
@Module({
  imports: [
    Config.forRoot({
      isGlobal: true,
      envFilePath,
      validationSchema: schema,
    }),
  ],
})
export class ConfigModule {}

